/*
 * @lc app=leetcode.cn id=1318 lang=golang
 *
 * [1318] 或运算的最小翻转次数
 */
package Solutions

// @lc code=start
func minFlips__(a int, b int, c int) int {
	ans := 0
	for {
		at := a & 1
		bt := b & 1
		ct := c & 1
		a >>= 1
		b >>= 1
		c >>= 1
		if at|bt == ct {
			if c|b|a == 0 {
				break
			}
			continue
		}
		if ct == 0 {
			if at == 1 {
				ans++
			}
			if bt == 1 {
				ans++
			}
		} else {
			ans++
		}

	}
	return ans
}

// @lc code=end
